package fengstyle.stock;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class StockService {

    @Resource
    private StockMapper mapper;

    @Transactional
    public void addStock(Stock stock) {
        mapper.insert(stock);
    }

    @Transactional
    public void addStockException(Stock stock){
        addStock(stock);
        throw new RuntimeException("stock异常");
    }
}
